package com.btt.ff14Tools.entity;

import javafx.beans.property.SimpleStringProperty;
import javafx.scene.control.CheckBox;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 幻卡实体类
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class HuanKa {
    private Integer index;           //编号
    private String sIndex;          //官方编号
    private String dataPatch;       //版本号
    private String cardName;        //幻卡名字
    private String imgUrlS;         //缩略图链接
    private String imgUrlB;         //幻卡图
    private String rare;            //星级（稀有度）
    private String org;             //属性
    private Integer top;             //数值-上
    private Integer right;           //数值-右
    private Integer down;            //数值-下
    private Integer left;            //数值-左
    private String methods;         //获取途径
    private Boolean isObtained = false;     //是否已获取
    private CheckBox box = new CheckBox();
    private final SimpleStringProperty isObtainedStr = new SimpleStringProperty();

    public void setIsObtained(Boolean flag){
        this.isObtained = flag;
        this.box.setSelected(flag);
        this.isObtainedStr.set(flag? "Got!":"");
    }

    public void setSIndex(String str){
        System.out.println(this.index + " " + str);
        this.sIndex = str;
        try{
            Integer temp = Integer.valueOf(str);
            if(temp != this.index){
                this.index = temp;
            }
        }catch (Exception ignored){
        }
    }

    public String getIsObtainedStr(){
        return isObtainedStr.get();
    }
}
